<!DOCTYPE html>

<!--
Copyright Adam Pritchard 2015
MIT License : http://adampritchard.mit-license.org/
-->

<html lang="en">

<head>
  <meta charset="utf-8"/>
  <meta name="viewport" content="width=device-width"/>
  <link rel="icon" type="image/png" href="images/icon32.png"/>

  <title data-i18n="page_title">Markdown Here Options</title>

  <style type="text/css">
  /*
  The palette can be seen here: http://paletton.com/#uid=64G0u0ks8sIhj-JmfuftVmIzshO
  */

  body {
    font-family: Tahoma, Helvetica, arial, freesans, clean, sans-serif;
    font-size: 14px;
    color: #14021F;
  }

  .pagehead {
    margin: 10px 0 0 10px;
  }

  h1 {
    color: #3E055F;
    text-shadow: 1px 1px 1px rgba(72, 33, 104, 0.25);
    vertical-align: top;
    /* Needs to match the height of the image */
    line-height: 48px;
  }

  img.text-align {
    vertical-align: middle;
  }

  img[src^="images/icon32"] {
    width: 16px;
  }

  img[src^="images/icon96"] {
    width: 48px;
  }

  textarea {
    font-size: 0.8em;
  }

  .horiz-groupset {
    height: 400px;
    width: 100%;
    overflow: auto;
  }

  .control-group {
    float: left;
    width: 45%;
    width: calc(50% - 40px);
    height: 360px;
    height: calc(100% - 40px);
    margin: 10px;
    padding: 10px;
    background-color: #EEE;
    border-radius: 5px;
    box-shadow: 2px 2px 3px rgba(0, 0, 0, .2);
    overflow-y: auto;
  }

  .control-group > * {
    margin: 5px 0;
  }

  .control-group > .stretch {
    height: 280px;
    height: calc(100% - 80px);
  }

  .stretch {
    position: relative;
  }

  .stretch > * {
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    position: absolute;
    height: 100%;
    width: 100%;
  }

  .section-title {
    font-size: 1.2em;
    font-weight: bold;
    color: #3E055F;
    text-shadow: 1px 1px 1px rgba(72, 33, 104, 0.25);
  }

  .iframe-container {
    background-color: #FFF;
  }

  #notes {
  }

  #notes ul {
    padding-left: 30px;
  }

  #notes li {
    padding-bottom: 5px;
  }

  #saved-msg {
    position: fixed;
    top: 0;
    right: 0;
    font-size: 1.5em;
    padding: 1em;
    background: linear-gradient(225deg, #D4AFEA, rgb(255,255,255));
    color: #510E79;
    transition: opacity 1000ms;
    opacity: 0;
    border-bottom-left-radius: 30px;
    z-index: 99;
  }

  #saved-msg.showing {
    transition: opacity 100ms;
    opacity: 0.95;
  }

  /* button styling from http://webdesignerwall.com/tutorials/css3-gradient-buttons */
  .button {
    display: inline-block;
    outline: none;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    font-size: 1em;
    padding: .3em 1em;
    text-shadow: 0 1px 1px rgba(0,0,0,.3);
    border-radius: .5em;
    box-shadow: 0 1px 2px rgba(0,0,0,.2);
  }
  .button:hover {
    text-decoration: none;
  }
  .button:active {
    position: relative;
    top: 1px;
  }
  .purple {
    color: #EEE;
    border: solid 1px #3E055F;
    background: linear-gradient(270deg, #6A1A99, #510E79);
  }
  .purple:hover {
    background: linear-gradient(270deg, #7A37A1, #6A1A99);
  }
  .purple:active {
    background: linear-gradient(270deg, #510E79, #6A1A99);
  }

  #css-syntax-select {
    font-size: 1em;
    border-radius: .5em;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
    background: #510E79;
    padding: 0.2em;
    outline: none;
  }

  #css-syntax-select > option{
    background-color: inherit;
    font: inherit;
  }

  footer {
    margin: 1em auto;
    max-width: 700px;
    text-align: center;
  }

  textarea {
    font-family: Consolas, Inconsolata, Courier, monospace;
  }

  input[type="text"] {
    width: 90%;
    font-size: 1em;
    background-color: #F6E6FF;
  }

  .warning {
    background-color: #E6E619;
    display: inline-block;
    padding: 0.2em;
    border-radius: 0.3em;
  }

  .hidden {
    visibility: hidden;
  }

  #changelist li {
    margin: 0.5em 0;
  }

  #changelist li p {
    margin: 0;
  }

  ol > li {
    margin-bottom: 0.3em;
  }

  #resources li {
    margin-bottom: 0.3em;
  }

  #tests-link {
    font-size: 0.5em;
    text-align: right;
  }

  #changelist {
    height: 25em;
    overflow-y: scroll;
    border-radius: 5px;
    box-shadow: 2px 2px 3px rgba(0, 0, 0, .2);
    border: 2px #EEE solid;
    margin: 10px;
    padding: 10px;
  }

  .changelist-new {
    border-radius: 5px;
    background: linear-gradient(90deg, #E7D7F1, rgb(255,255,255));
    padding-left: 0.5em;
    padding-right: 0.5em;
    padding-bottom: 0.1em;
  }

  .changelist-new h2:first-child {
    color: #FFF;
    text-shadow: 1px 1px 2px black, 0 0 1em #510E79, 0 0 0.2em #510E79;
    margin-bottom: 0;
  }

  #changelist > h1 {
    margin-top: 0;
    margin-bottom: 0;
  }

  hr {
    border: 0;
    border-top: 1px dashed #945AB7;
    width: 90%;
  }

  .extra-description {
    font-size: 0.8em;
    padding-left: 3em;
  }

  #donate-buttons {
    margin-top: 0.3em;
  }

  #donate-buttons > * {
    vertical-align: middle;
    margin: 0.5em;
  }

  .donate-plea-hidden {
    display: none;
  }

  /* Custom PayPal button styles from http://visitsteve.com/made/diy-paypal-buttons/ */
  .paypal-button {
    color: #2e3192;
    text-decoration: none;
    text-align: center;
    position: relative;

    /* BACKGROUND GRADIENTS */
    background: #FEE1A5;
    background: linear-gradient(to bottom, #FFF, #FEE1A5 50%, #FFB829 51%, #FEE1A5 95%, #FEE1A5);

    /* BORDER RADIUS */
    border-radius: 18px;

    border-bottom: 1px solid #FFF;
    border-top: 1px solid #FFB829;
    border-left: 1px solid #FEE1A5;
    border-right: 1px solid #FEE1A5;

    /* TEXT SHADOW */

    text-shadow: 0px 1px 1px white;

    /* BOX SHADOW */
    box-shadow: 0 1px 3px #777;
    font: italic bold 20px/28px helvetica, arial;
  }
  /* WHILE HOVERED */
  .paypal-button:hover {
    background: #FEE1A5;
    background: linear-gradient(to bottom, #FFF, #FEE1A5 50%, #FFB829 51%, #FEE1A5 95%, #FEE1A5);
    box-shadow: 0 1px 2px black;
    cursor: pointer;
  }
  /* WHILE BEING CLICKED */
  .paypal-button:active {
    box-shadow: 0 2px 6px black;
  }
  </style>
</head>

<body>

  <header id="pagehead" class="pagehead">
    <h1>
      <img class="text-align" src="images/icon96.png"/>
      <span data-i18n="page_title">Markdown Here Options</span>
    </h1>
  </header>

  <div class="horiz-groupset">
    <div id="usage" class="control-group">
      <div class="section-title" data-i18n="basic_usage">
        Basic Usage
      </div>
      <div>
        <ol>
          <li id="need-page-reload" data-i18n="reload_restart">
            After installing or upgrading, reload your email web page or restart your web browser.
          </li>
          <li data-i18n="start_new_message">
            Start a new email message.
          </li>
          <li data-i18n="type_some_markdown">
            Type some Markdown into the email.<br/>Try this: <code>_Hello_ `Markdown` **Here**!</code>
          </li>
          <li data-i18n="click_toggle">
            Right-click in the email and then click "Markdown Toggle". (Or click the <img class="text-align" src="images/icon32-button-monochrome.png"/> button on the toolbar.<span class="hotkey-display-wrapper"> Or press <span class="hotkey-display"><kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>M</kbd></span></span>)
          </li>
          <li data-i18n="pretty_cool">
            The message should now look pretty cool. Send it to your friends!
          </li>
        </ol>
      </div>
    </div>

    <div id="resources" class="control-group">
      <div class="section-title" data-i18n="resources_title">
        Resources and Links
      </div>
      <div>
        <ul>
          <li data-i18n="resources_cheatsheet_link">
            If you're new to Markdown, the <a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Here-Cheatsheet" target="_blank">Markdown Here Cheatsheet</a> will make you a prostar.
          </li>
          <li data-i18n="advanced_usage">
            For lots more info and advanced usage, see the <a href="https://github.com/adam-p/markdown-here" target="_blank">Markdown Here project page</a>. You should also explore the options below.
          </li>
          <li data-i18n="ggroup">
            Ask a question, start a discussion, or just say hi in the <a href="https://groups.google.com/forum/?fromgroups=#!forum/markdown-here" target="_blank">markdown-here Google Group</a>.
          </li>
          <li data-i18n="mdh_wiki">
            Visit the <a href="https://github.com/adam-p/markdown-here/wiki" target="_blank">Markdown Here wiki</a> for info about <a href="https://github.com/adam-p/markdown-here/wiki/Compatibility" target="_blank">where else MDH works</a> and more <a href="https://github.com/adam-p/markdown-here/wiki/Tips-and-Tricks" target="_blank">tips and tricks</a>.
          </li>
          <li data-i18n="next_steps">
            If you're interested in what the future holds for Markdown Here, check out the <a href="https://github.com/adam-p/markdown-here#next-steps" target="_blank">Next Steps section</a> of the README.
          </li>
        </ul>

        <hr/>

        <div>
          <span class="donate-plea donate-plea-hidden" id="dp1" data-i18n="donate_plea_1">Once you decide Markdown Here is pretty sweet, please help me to buy some flowers for my wife so she's not too upset about how much time I spend working on it. <strong>Thank you!</strong></span>
          <span class="donate-plea donate-plea-hidden" id="dp2" data-i18n="donate_plea_2"><strong>Help make Markdown Here better!</strong></span>
          <span class="donate-plea donate-plea-hidden" id="dp3" data-i18n="donate_plea_3"><strong>Help support the development of Markdown Here!</strong></span>
          <span class="donate-plea donate-plea-hidden" id="dp4" data-i18n="donate_plea_4">You know what makes it easier to keep Markdown Here working on Chrome, Firefox, Thunderbird, Postbox, Safari, Opera, Gmail, Yahoo, Hotmail, Blogger, Evernote, etc.? <strong>Coffee!</strong></span>

          <div id="donate-buttons">
            <form style="display:inline" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
            <input type="hidden" name="cmd" value="_donations"/>
            <input type="hidden" name="business" value="9PNMFUUB4WVGY"/>
            <input type="hidden" name="lc" value="CA"/>
            <input type="hidden" name="item_name" value="Markdown Here development support"/>
            <input type="hidden" name="item_number" value="options-page"/>
            <input type="hidden" name="currency_code" value="CAD"/>
            <input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHosted"/>
            <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"/>

            <input id="paypal-submit-css" class="paypal-button" type="submit" value="Donate with PayPal" alt="PayPal - The safer, easier way to pay online!"/>
            </form>

            <a href="http://markdown-here.com/about.html" target="_blank" data-i18n="other_donation_options">
              Other donation options
            </a>

          </div>
        </div>
      </div>
    </div>
  </div>

  <div id="options-container">

    <div class="horiz-groupset">

      <div class="control-group">
        <div class="section-title" data-i18n="primary_css_title">
          Primary Styling CSS
        </div>
        <div class="stretch">
          <textarea id="css-edit" wrap="off"></textarea>
        </div>
        <div>
          <button id="reset-button" class="button purple" data-i18n="reset_primary_css">
            Reset to Default
          </button>
        </div>
      </div>

      <div class="control-group">
        <div class="section-title" data-i18n="syntax_highlighting_css_title">
          Syntax Highlighting CSS
        </div>
        <div class="stretch">
          <textarea id="css-syntax-edit" wrap="off"></textarea>
        </div>
        <div>
          <span data-i18n="syntax_highlighting_theme_label">Theme:</span>
          <select class="purple" id="css-syntax-select"></select>
        </div>
      </div>

    </div>

    <div class="horiz-groupset">

      <div class="control-group">
        <div class="section-title" data-i18n="preview_title">
          Preview
        </div>
        <div class="stretch iframe-container">
          <iframe id="rendered-markdown" src="options-iframe.html">
            <!-- rendered Markdown preview will appear here -->
          </iframe>
        </div>
        <div>
          <button id="markdown-toggle-button" class="button purple" data-i18n="markdown_toggle_button_text">
            Markdown Toggle
          </button>
        </div>
      </div>

      <div class="control-group">
        <div class="section-title" data-i18n="notes_title">
          Notes
        </div>
        <div id="notes">
          <ul>
            <li data-i18n="note_options_sync">Changes are automatically saved and synchronized (if sync is enabled in your browser).</li>
            <li data-i18n="note_syntax_styles_after_primary">The syntax highlighting styles are applied after the primary styling, and so take precedence.</li>
            <li data-i18n="note_default_client_styles">Some email editors and browsers impose their own styles. Those may not be apparent here.</li>
          </ul>
        </div>
      </div>

    </div>

    <div class="horiz-groupset">

      <div class="control-group">
        <div class="section-title" data-i18n="tex_math_title">
          TeX Mathematical Formulae Support
        </div>

        <div>
          <input type="checkbox" id="math-enable"/>
          <input type="text" id="math-edit"/>
        </div>

        <div>
          <button id="math-reset-button" class="button purple">
            <span data-i18n="tex_math_reset_button">Reset to Default</span>
          </button>
        </div>

        <div id="notes">
          <p>
            <span data-i18n="tex_math_privacy_heading"><strong>Privacy Issues:</strong></span>
            <ul>
              <li data-i18n="tex_math_privacy_issue_1">
                To generate the image for the formula, a request is sent to Google. That effectively means that you are sharing your formula with Google. It also means that recipients of your message will be making a request to Google to have the image rendered.
              </li>
              <li data-i18n="tex_math_privacy_issue_2">
                If you customize the formula rendering tag, you should use a secure (https://) path. Not all rendering services provide a secure option.
              </li>
            </ul>
          </p>

          <p>
            <span data-i18n="tex_math_customization_heading"><strong>Customization and Use:</strong></span>
            <ul>
              <li data-i18n="tex_math_customization_1">
                If this feature is enabled, text between dollar signs — <code>$</code> — will be interpreted as mathematical formulae. For example, <code>$\Delta$</code> would be rendered as a delta symbol.
              </li>
              <li data-i18n="tex_math_customization_2">
                For render customization options, see the <a href="https://developers.google.com/chart/infographics/docs/formulas" target="_blank">Google Charts documentation</a> for this service.
              </li>
              <li data-i18n="tex_math_customization_3">
                A good resource for creating TeX formulae is the <a href="https://www.codecogs.com/latex/about.php" target="_blank">CodeCogs Equation Editor</a>.
              </li>
              <li data-i18n="tex_math_customization_4">
                Formulae are rendered to images, so email recipients will have to enable images to be shown to see the rendering.
              </li>
              <li data-i18n="tex_math_customization_5">
                If you customize the rendering tag, you can (and should) use either or both of <code>{mathcode}</code> and <code>{urlmathcode}</code> as placeholders.
                <ul>
                  <li data-i18n="tex_math_customization_5_1"><code>{mathcode}</code>: The text between the <code>$</code> symbols — i.e., the raw TeX formula; like <code>\Delta</code>.</li>
                  <li data-i18n="tex_math_customization_5_2"><code>{urlmathcode}</code>: The URL-encoded form of the TeX formula; like <code>%5CDelta</code>.</li>
                </ul>
              </li>
              <li data-i18n="tex_math_customization_6">
                If you customize the <code>&lt;img&gt;</code> tag, you should include an <code>alt</code> attribute that has as human-readable a value as possible, like <code>{mathcode}</code>. This value of this attribute will be used for the plaintext version of the email (when sent from Gmail and Thunderbird), and used by screen readers for sight-impaired recipients.
              </li>
            </ul>
          </p>
        </div>

      </div>

      <div class="control-group">
        <div class="section-title" data-i18n="hotkey_title">
          Hotkey (aka keyboard shortcut)
        </div>
        <div>
          <input type="checkbox" id="hotkey-shift"/><label for="hotkey-shift" data-i18n="hotkey_shift_key">SHIFT</label>
          &nbsp;<span data-i18n="hotkey_plus">+</span>&nbsp;
          <input type="checkbox" id="hotkey-ctrl"/><label for="hotkey-ctrl" data-i18n="hotkey_ctrl_key">CTRL</label>
          &nbsp;<span data-i18n="hotkey_plus">+</span>&nbsp;
          <input type="checkbox" id="hotkey-alt"/><label for="hotkey-alt" data-i18n="hotkey_alt_key">ALT</label>
          &nbsp;<span data-i18n="hotkey_plus">+</span>&nbsp;
          <input type="text" id="hotkey-key" maxlength="1" placeholder="KEY" style="width: 3em;"/>
        </div>
        <div id="hotkey-key-warning" class="warning hidden" data-i18n="hotkey_warning">
          Is the key an alphanumeric value?
        </div>
        <div id="notes">
          <ul>
            <li data-i18n="hotkey_note_1">
              Chrome: You must reload your email web page for the new hotkey setting to take effect.
            </li>
            <li data-i18n="hotkey_note_2">
              Firefox and Thunderbird: You must restart the application for the new hotkey setting to take effect.
            </li>
            <li data-i18n="hotkey_note_3">
              You must use an alphanumeric key for the shortcut (varies by language and keyboard).
            </li>
            <li data-i18n="hotkey_note_4">
              The Windows key and the OS X &#8984; key cannot be used in the shortcut.
            </li>
            <li data-i18n="hotkey_note_5">
              To disable the use of this hotkey, leave the "key" text box empty.
            </li>
          </ul>
        </div>
      </div>

    </div><!-- /.horiz-groupset -->

  </div><!-- /#options-container -->

  <div id="changelist-container">
    <div id="changelist">
    </div>
  </div>

  <div id="extra-options-container">
    <div class="horiz-groupset">

      <div class="control-group">
        <div class="section-title" data-i18n="advanced_title">
          Advanced and Miscellaneous
        </div>
        <div>
          <input type="checkbox" id="forgot-to-render-check-enabled"/>
          <label for="forgot-to-render-check-enabled" data-i18n="forgot_to_render_label">
            <b>Enable "forgot-to-render" check.</b>
          </label>
          <div class="extra-description">
            <p data-i18n="forgot_to_render_1">
              Currently only supported in the Gmail web interface and Thunderbird (and Postbox and Icedove).
            </p>
            <p data-i18n="forgot_to_render_2">
              When you send an email, this checks the content to see if it looks like you wrote it in Markdown, but forgot to render it (i.e., click "Markdown Toggle") before sending. This may need to be disabled if it interferes with your ability to send email.
            </p>
            <p data-i18n="forgot_to_render_4">
              If this feature stops working for you, please let us know by posting to the <a href="https://groups.google.com/group/markdown-here" target="_blank">"markdown-here" Google Group</a> or creating <a href="https://github.com/adam-p/markdown-here/issues" target="_blank">an issue in the Github project</a>. (Hooking into the email sending web UI is brittle and will sometimes break.)
            </p>
          </div>
        </div>
        <hr/>
        <div>
          <input type="checkbox" id="header-anchors-enabled"/>
          <label for="header-anchors-enabled" data-i18n="header_anchors_enabled_label">
            <b>Enable automatic header anchors.</b>
          </label>
          <div class="extra-description">
            <p data-i18n="header_anchors_enabled_1">
              This is great if you want to put a table of contents or other internal links into your content. <a href="https://github.com/adam-p/markdown-here/wiki/Tips-and-Tricks#wiki-header-anchors" target="_blank">Learn about how to use it in the MDH wiki.</a>
            </p>
            <p data-i18n="header_anchors_enabled_2">
              It's disabled by default because it <a href="https://github.com/adam-p/markdown-here/issues/155" target="_blank">creates visual noise in Thunderbird</a>. (And most people probably won't use the feature.)
            </p>
          </div>
        </div>
        <hr/>
        <div>
          <input type="checkbox" id="gfm-line-breaks-enabled"/>
          <label for="gfm-line-breaks-enabled" data-i18n="gfm_line_breaks_enabled_label">
            <b>Enable GFM line breaks.</b>
          </label>
        </div>
        <hr/>
      </div>

      <div class="control-group">
        <div class="section-title" data-i18n="contributing_title">
          Contributing
        </div>
        <div>
          <p data-i18n="contributing_1">
            <strong>If you have ever put a code block into an email, then you can help make Markdown Here better.</strong> <a href="https://github.com/adam-p/markdown-here/blob/master/CONTRIBUTING.md" target="_blank">CONTRIBUTING.md</a>
          </p>
          <p data-i18n="contributing_2">
            Help make Markdown Here available in your language. <a href="https://github.com/adam-p/markdown-here/blob/master/CONTRIBUTING.md#translation" target="_blank">Translations are welcome.</a>
          </p>
        </div>
      </div>

    </div><!-- /.horiz-groupset -->
  </div><!-- /#extra-options-container -->

  <footer>
    <p data-i18n="footer_1">
      <em>Markdown Here</em> is open source. To ask questions, report bugs, request features, or contribute, visit the <a target="_blank" href="https://github.com/adam-p/markdown-here">Github project page</a> or the <a target="_blank" href="https://groups.google.com/forum/?fromgroups=#!forum/markdown-here">"markdown-here" Google Group</a>.
    </p>
    <p data-i18n="footer_2">
      Created by <a target="_blank" href="http://adam-p.github.com/">Adam Pritchard</a>.
    </p>
  </footer>

  <div id="tests-link"><a href="./test/index.html"><img title="Run tests" src="images/icon16.png"/></a></div>

  <div id="saved-msg" data-i18n="changes_saved">Changes saved</div>

  <script src="jsHtmlToText.js"></script>
  <script src="marked.js"></script>
  <script src="highlightjs/highlight.js"></script>

  <script src="utils.js"></script>
  <script src="common-logic.js"></script>
  <script src="mdh-html-to-text.js"></script>
  <script src="markdown-render.js"></script>
  <script src="markdown-here.js"></script>

  <script src="options-store.js"></script>
  <script src="options.js"></script>

  <script src="vendor/jquery-3.2.1.slim.min.js"></script>

</body>

</html>
